/**  
 * All rights Reserved, Designed By <a href="www.itttq.com" target="_blank">www.itttq.com</a>
 * @date:   2017-07-21 11:42:21
 * @Copyright: 2017 <a href="www.itttq.com" target="_blank">www.itttq.com</a> Inc. All rights reserved. 
 */
package com.itttq.gshop.pbpm.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.itttq.gshop.domain.po.SysAreaPo;
import com.itttq.gshop.generic.controller.GenericController;
import com.itttq.gshop.pbpm.service.SysAreaService;

@RestController
@RequestMapping("sysArea")
public class SysAreaController extends GenericController {
	private static final long serialVersionUID = -1576990624956828L;
	public static final String CACHE_KEY = "sysArea";
	@Autowired
	private SysAreaService areaService;
	
	/**
	 * 根据父级ID查询区域信息
	 * 
	 * @param pid	父级ID
	 * @Author 迷蝶
	 * @return List<SysAreaPo>
	 */
	@RequestMapping("{pid:^[0-9]*$}")
	@Cacheable(value=CACHE_KEY, key="'sysArea_'+#id")
	public List<SysAreaPo> getAreasByPid(@PathVariable("pid") int pid) {
		return areaService.getAreasByPid(pid);
	}
	
}
